package com.wu.util.spider;

import com.wu.util.spider.service.impl.XiGuaVideoServiceWorkerImpl;
import com.wu.util.spider.util.SpiderConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author 50816
 */
@Component
public class SpiderApplicationRunner implements ApplicationRunner {

    Logger logger = LoggerFactory.getLogger(SpiderApplicationRunner.class);
    private static final String URL = "url";

    @Autowired
    @Qualifier("xiGuaVideoServiceWorkerImpl")
    XiGuaVideoServiceWorkerImpl serviceWorker;

    @Autowired
    SpiderConfiguration spiderConfiguration;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        logger.info("\r\n------------- 开始进行爬虫任务  ----------------");
        serviceWorker.initService();
        serviceWorker.startService();
        logger.info("\r\n------------- 完成爬虫任务  ----------------");
    }
}
